package com.inossem.warehousestorage_inossem.activity.inventory;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.inossem.utils.listener.NoDoubleClickListener;
import com.inossem.warehousestorage_inossem.R;
import com.inossem.warehousestorage_inossem.activity.base.BaseActivity;

public class InventoryResultActivity extends BaseActivity {

    private TextView title, result;

    private Button  confirm;


    @Override
    protected void onCreateImpl(Bundle savedInstanceState) {
        setContentView(R.layout.activity_inventory_result);
        initView(InventoryResultActivity.this);
        initData(InventoryResultActivity.this);
    }

    private void initView(Activity activity) {
        title = (TextView) activity.findViewById(R.id.headerTitle);
        result = (TextView) activity.findViewById(R.id.result);
        confirm = (Button)activity.findViewById(R.id.confirm);
        confirm.setOnClickListener(new NoDoubleClickListener() {
            @Override
            public void onNoDoubleClick(View v) {
                goManageActivity(activity);
            }
        });
    }

    private void initData(Activity activity) {
        title.setText(activity.getResources().getString(R.string.activity_inventory_result_title));
        getData(activity);
    }


    private void getData(Context context) {
            result.setText(context.getResources().getString(R.string.activity_receive_result_confirm_success));
    }

    private void goManageActivity(Activity activity) {
        Intent intent = new Intent(activity, Inventory_ManageActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        activity.startActivity(intent);
        activity.finish();
    }

    @Override
    public void onBackPressed() {
        goManageActivity(this);
    }
}
